﻿using System;
using System.Collections.Generic;
using System.Linq;
using System.Web;
using System.Web.UI;
using System.Web.UI.WebControls;
using System.Data;
using System.Configuration;
using System.Collections;
using System.Web.Security;
using System.Web.UI.WebControls.WebParts;
using System.Web.UI.HtmlControls;

public partial class DetailHotel : System.Web.UI.Page
{
    private static int hotelID;

    protected void Page_Load(object sender, EventArgs e)
    {
        if (Request.QueryString["hotelID"] == null)
            return;
        else
            hotelID = int.Parse(Request.QueryString["hotelID"].ToString());

        LoadData();
    }

    private void LoadData()
    {
        DataTable dtHotel = HotelManagement.GetHotelByID(hotelID).Tables[0];
        DataList3.DataSource = dtHotel;
        DataList3.DataBind();

        DataTable dtImages = ImageManagement.GetImgByForeignID(hotelID, Common.IMAGE_HOTEL).Tables[0];
        DataList4.DataSource = dtImages;
        DataList4.DataBind();

        DataTable dtOtherHotel = HotelManagement.GetAllOtherHotel(hotelID).Tables[0];
        DataList5.DataSource = dtOtherHotel;
        DataList5.DataBind();
    }
    protected void lbtBack_Click(object sender, EventArgs e)
    {
        Response.Redirect("ListHotels.aspx");
    }
    protected void LinkButton1_Click(object sender, EventArgs e)
    {
        LinkButton myButton = sender as LinkButton;
        if (myButton != null)
        {
            hotelID = int.Parse(myButton.CommandArgument);

            //LoadData();
            Response.Redirect("DetailHotel.aspx?hotelID=" + hotelID);
        }
    }
}